<!--
 * @Descripttion: 
 * @version: 
 * @Author: Ansel
 * @Date: 2020-03-06 22:20:15
 * @LastEditors: Ansel
 * @LastEditTime: 2020-05-17 12:20:13
 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // function quickSort(arr){
        //     function _quickSort(arr,start,end){
        //         if(start > end||start > arr.length - 1) return;
        //         var low = start;
        //         var high = end;
        //         var key = arr[end];
        //         while(low < high){
        //             while(low < high && arr[low] <= key) low++;
        //             arr[high] = arr[low];
        //             while(low < high && arr[high] >= key ) high --;
        //             arr[low] = arr[high];
        //         }
        //         arr[low] = key;
        //         _quickSort(arr, start, low - 1);
        //         _quickSort(arr, low + 1 , end);
        //     }
        //     _quickSort(arr,0,arr.length - 1);
            
        // }
        // var arr = [5, 3, 1, 6, 7, 4];
        // quickSort(arr);
        // console.log(arr);
        function quickSort(arr){
            function _quickSort(arr,start,end){
                let low = start;
                let high = end;
                let key = arr[end];
                while(low<high){
                    while(low<high&& key >= arr[low]) low ++;
                    arr[high] = arr[low];
                    while(low<high&& key <= arr[high]) high --;
                    arr[low] = arr[high];
                }
                arr[low] = key;
                _quickSort(arr,start,low - 1);
                _quickSort(arr,low + 1,end);
            }
            _quickSort(arr,0,arr.length - 1);
        }
    </script>
</body>
</html>